/**
 * 给定L和R，找a和b，满足：
 * 1. L <= a + b <= R
 * 2. gcd(a, b) != 1
 * R在1E7
 * 首先筛出所有质数，然后对每个质数枚举即可
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>
using namespace __gnu_pbds;

using Real = long double;
using llt = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

#ifndef ONLINE_JUDGE
int const SZ = 101;
#else
int const SZ = 110;
#endif

struct Sieve{ 

using llt = int;
vector<bool> isComp;
vector<llt> primes;

Sieve(int SZ = 35000){
    primes.reserve(SZ);
    isComp.assign(SZ, false);    

    long long tmp;
    for(int i=2;i<SZ;++i){
        if(!isComp[i]){
            primes.push_back(i);
        }

        for(int j=0,n=primes.size();j<n&&(tmp=i*(long long)primes[j])<SZ;++j){
            isComp[tmp] = true;
            if(0 == i % primes[j]){
                break;
            }else{

            }
        }
    }
}

}SIEVE;

llt L, R;

void proc(){
    for(auto p : SIEVE.primes){
		auto t = R / p;
        if(t <= 1) break;
		if(t * p >= L) return (void)(cout << t << " " << (p - 1) * t << endl); 
	}

	return (void)(cout << -1 << endl);
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase; cin >> nofkase;
	while(nofkase--){
        cin >> L >> R;
		proc();
	}
    return 0;
}